import request from './request'

export const getCourses = (params) => {
  return request.get('/courses', { params })
}

export const getCourseDetail = (id) => {
  return request.get(`/courses/${id}`)
}

export const getCategories = () => {
  return request.get('/courses/categories')
}

export const getMyCourses = () => {
  return request.get('/courses/my')
}

export const purchaseCourse = (courseId) => {
  return request.post('/courses/purchase', { courseId })
}

export const getCourseProgress = (courseId) => {
  return request.get(`/courses/${courseId}/progress`)
}

export const updateCourseProgress = (courseId, data) => {
  return request.put(`/courses/${courseId}/progress`, data)
}
